﻿using System;
using System.Collections.Generic;
using System.Text;

namespace X3DLib
{
    public class IndexedLineSet : Rendering
    {

        public IndexedLineSet()
            : base()
        {
        }

        public IndexedLineSet(string coordindex, Coordinate coordinate)
            : base()
        {
            this.coordIndex = coordIndex;
            this.Coordinate = coordinate;
        }

        public override string getAttrs()
        {
            return "DEF|" + this.DEF + "|string,"
                  + "USE|" + this.USE + "|string,"
                  + "coordIndex" + this.coordIndex + "|int,"
                  + "coordinate" + this.coordinate.point + "|string";
        }

        public override void setAttrs(string attrs)
        {
            string[][] temp = X3DString.getArrayByAttrs(attrs);
            for (int i = 0; i < temp.Length; i++)
            {
                switch (temp[i][0])
                {
                    case "DEF":
                        this.DEF = temp[i][1];
                        break;
                    case "USE":
                        this.USE = temp[i][1];
                        break;
                    case "coordIndex":
                        this.coordIndex = temp[i][1];
                        break;
                    case "coordinate":
                        this.coordinate = new Coordinate(temp[i][1]);
                        break;
                }
            }
        }
    }
}
